package demo.springboot.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import demo.springboot.entity.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


/**
 * @author yexi
 */
@Mapper
public interface EmployeeMapper extends BaseMapper<Employee> {

    /**
     * 查询最新的雇员。
     * 同时此处的该方法也证明了 Mybatis-Plus 只做增强，依旧保留 Mybatis 特性。
     *
     * @return 最新雇员
     */
    @Select("select * from employee where emp_no = (select max(emp_no) from employee e)")
    Employee findNewestEmployee();

}
